package com.example.demo.indicator;

import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

/**
 * 以 HealthIndicator 结尾的健康检查，默认检查项去除此后缀，比如当前监控指标为：myDemo
 * 监控查看地址：http://localhost:8889/actuator/health/
 * 注意开启健康检查的详细配置：management.endpoint.health.show-details=always
 */
@Component
public class MyDemoHealthIndicator extends AbstractHealthIndicator {
    @Override
    protected void doHealthCheck(Health.Builder builder) throws Exception {
        builder.status(Status.UP).withDetail("status","OK");
    }
}
